﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Wicresoft.SMS.Data
{
    public class sqlWebSendDataAccess : ISendWebDataAccess
    {
        private IConnectStringProvider _connParamProvider;
         private string _connectionString;

         public sqlWebSendDataAccess(string ConnectionString)
        {
            _connectionString = ConnectionString;
        }

         public int SendSms(string addresslist, string addresslists, string UserName)
         {
             System.Data.Objects.ObjectParameter outs = new System.Data.Objects.ObjectParameter("outs", System.Data.DbType.Int32);
             try
             {
                 using (var dbModel = new Entities(_connectionString))
                 {
                     //TODO 密码要去掉
                     dbModel.cp_send_sms("Admin", "admin", addresslists, addresslist, outs);
                     dbModel.SaveChanges();
                 }
             }
             catch (Exception ex)
             {
                 System.Diagnostics.Debug.WriteLine(ex.Message);
                 return -1;
             }
             return Convert.ToInt32(outs.Value);
         }
    }
}
